<?php
require_once('Zend/Db.php');
require_once('./libs/classes/articleTable.class.php');
require_once('./libs/classes/dbconection.class.php');
class Articleop
{
	static $dbLink;
	/*
	 * 建立数据库链接
	 */
	
	public function __construct()
	{
		self::$dbLink = dbconection::makealink();
	}
	
	/*
	  *写日记传入数组 
	  */
	 public function writeA($arr)
	{
		$articlebiao = new article();
		return $articlebiao->insert($arr);
	}
	
	/*
	 *删除日记传入文章id 
	 */
	
	public function delA($para)
	{
		return self::$dbLink->query("delete from article where article_id=$para");
	}
	
	/*
	 * 显示日记 传入 $para1每页多少张 $para2第几页 $para3为用户id
	 */
	
	public function selectS($paraa=0,$para3,$para1=7,$para2=1)
	{
		$temp = ($para2-1)*$para1;
		$articlebiao = new article();
		if($paraa!=0)
		{
			$rows = $articlebiao->fetchAll("article_uid=$para3&&article_id!={$paraa}",'article_id desc',$para1,$temp);		
		}else
		{
			$rows = $articlebiao->fetchAll("article_uid=$para3",'article_id desc',$para1,$temp);		
		}
		return $rows->toArray();
	}
	
	/*
	 * 修改日记传入$para为id
	 * 
	 */
	
	public function modA($para)
	{
		$articlebiao = new article();
		return $articlebiao->fetchRow("article_id=$para")->toArray();	
	}
	
	/*
	 * 查看一篇日记￥para为日记id 
	 */
	
	public function findA($para)
	{
		$articlebiao = new article();
		return  $articlebiao->fetchRow("article_id=$para")->toArray();
	}
}

?>